<template>
    <div>
        <bread-crumb></bread-crumb>
        <h1>工作台</h1>
        <input type="text" placeholder="请输入您的姓名" v-model="name"><br>
        <input type="text" placeholder="请输入您的房产证" v-model="fcz"><br>
        <input type="text" placeholder="请输入您的买房日期" v-model="startTime"><br>
    </div>
</template>

<script>
import Vue from 'vue'
import BreadCrumb from '@/components/BreadCrumb.vue'
export default {
    components: { BreadCrumb },
    name:'workplace',
    data(){
        return{
            name:'',
            fcz:'',
            startTime:''
        }
    },
    beforeRouteEnter:async function(to,from,next){
        console.log('------进入该组件---------');
        let result=await Vue.prototype.$api.users.getUserInfo()
        if(result.data.auth==1){
            console.log('------我是超级管理员-----------');
            next()
        }else if(result.data.auth==2){
            console.log('-------我是普通管理员----------------------');
            alert('您没有权限进入，请联系系统管理,为您开设权限')
        }
        // let result=await this.$api.users.getUserInfo()
        // console.log('result',result);
    },
    beforeRouteLeave(to,from,next){
        console.log('------离开该组件----------');
        if(this.name==''||this.fcz==''||this.startTime==''){
           if(window.confirm('您还没有输入完所有的信息，您确认你要离开吗?')){
             next()
           }
        }
    }
}
</script>

<style>

</style>